package com.dbs.interfaces.test.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.dbs.interfaces.test.service.TestService;

@RestController
public class FeignTestController {
	// 示例中没有加private 但是应该要加的
	@Autowired
	private TestService testService;

	@RequestMapping(value = "/add", method = RequestMethod.GET)
	// 访问是按照这个参数来 但service的参数必须和服务提供者接口的参数一致
	public Integer add(Integer c, Integer b) {
		// return restTemplate.getForEntity("http://COMPUTER-SERVICE/add?a=" + a
		// + "&b=" + b, Integer.class).getBody();
		return testService.add(c, b);
	}

}
